<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/app.css">
    <link rel="stylesheet" type="text/css" href="../../css/my.css">
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="/pc/js/all.js"></script>
    <style>
        .acc-form {
            padding:5px 10px;
            background:#ffffff;
        }
        .acc-form p {
            padding:10px;
            font-size:14px;
        }
        .acc-form input {
            margin:10px 5%;
            padding:5px 0;
            width:90%;
            border-bottom:1px solid #f0f0f0;
            font-size:20px;
        }
        .acc-form .btn {
            margin:10px auto;
            text-align:center;
        }
        .acc-form button {
            padding:10px 20px;
            color:#fefefe;
            font-size:20px;
            border:0;
            border-radius:2px;
            background-image:-webkit-linear-gradient(left , #589cff, #3360fa);
            background-image:-o-linear-gradient(left , #589cff, #3360fa);
            background-image:linear-gradient(left , #589cff, #3360fa);
            cursor:pointer;
        }
    </style>
</head>
<body>
<!--
    制作者：九哥
    页面：我的账户-提现
    时间：2019-07-29
-->





<!----------我的账户充值---------->
<div id="accountPage">
    <div id="accountTitle">
        <b>平台交易密码设置</b>
        <img src="../../images/return.png" id="accountRtn">
    </div>
    <div class="acc-form">
        <p>原密码：</p>
        <input type="text" placeholder="原密码输入" id="pwd" p/>
        <p style="color:#a0a0a0;font-size:12px;">
            原密码未设置？默认123456
        </p>
        <p>新密码：</p>
        <input type="text" placeholder="新密码输入：6位数字" id="pwd2"/>
        <p class="btn">
            <button onclick="setTradePwd()">确定更新</button>
        </p>
    </div>
</div>
<div  id="zfb"></div>
<!----------我的账户提现---------->





<!----------错误提示---------->
<div id="errMsg"></div>
<!----------错误提示---------->
</body>
<script type="text/javascript" src="../../js/app.js"></script>
<script type="text/javascript" src="../../js/cache.js"></script>
<script type="text/javascript" src="../../js/mysetPageChange.js"></script>
<script type="text/javascript" src="../../js/myset2.js"></script>
</html>

<script>
    /**
     * 交易密码设置
     * */
    function setTradePwd(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (userInfo==null || userInfo.token=='undefined') {
            window.location.href = '/h5/login/login.html';
        }
        var pwd = $('#pwd').val();
        var pwd2 = $('#pwd2').val();
        if (!pwd) {
            getAppErrMsg('原密码必填！','',0);
            return
        }
        if (!pwd2) {
            getAppErrMsg('新密码必填！','',0);
            return
        }
        var formData = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate,
            pwd:pwd,
            pwd2:pwd2
        };
        $.ajax({
            type: 'post',
            url: getDomain() + 'trade-pwd',
            data: formData,
            success: function(res){
                //console.log(res); return;
                if (res.code!=0) {
                    console.log(res.msg);
                    getAppErrMsg('更新失败！','',0);
                    return
                }
                console.log(res.data);
                getAppErrMsg('更新成功！','',0);
            },
            error: function(){
                console.log('操作失败！'); return;
            }
        });
    }
    /**
     * 地址前缀
     * */
    function getDomain(){
        return '/api/my/account/';
    }
</script>